package TCPDemo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo {
    public static void main(String[] args) {
        try {
            InetAddress inetAddress= InetAddress.getByName("www.baidu.com");
            InetAddress[] allByName = InetAddress.getAllByName("www.baidu.com");
            for (InetAddress inetAddress1 : allByName) {
                System.out.println(inetAddress1);
            }
            //实际的网络请求，  查缓存 查不到，就查DNS
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
    }
}
